218

|

6 Applications and Methods in Biosignal Processing

and on the other hand the frequency resolution of the spectrum. For the analysis, a

time signal was measured in which the patient alternates from a resting state with

closed eyes (alpha state) to a resting state with open eyes (beta state). For this purpose,

the EEG signal was derived at two locations at the back of the head (in the area of the

optic nerves) with respect to the reference electrode at the earlobe. The evaluation of

the EEG signals using the time-frequency spectrum in Matlab is given in Listing 6.1.

Listing: 6.1 Time-frequency analysis of an EEG signal from the Berger experiment.

A = importdata('eeg.txt');

% import EEG-data

EEG_raw = A.data(:,6);

% select correct column

EEG_mean = EEG_raw-mean(EEG_raw);

% remove direct component

Ts = 0.001;

% sample-period duration

Fs = 1/Ts;

% sample-frequency

[N,nu] = size(EEG_mean);

% determined data length

t = (1:N)*Ts;

% generated time vector

% Calculation of the time-frequency spectrum of the EEG

winlength = 2048;

% window length

[S1,F,T] = spectrogram(EEG_mean,chebwin(winlength,100),...

ceil(winlength/2),0:0.1:300, Fs);

S1 = abs(S1);

% amount formation

% Calculation of the power density spectrum of the EEG

[P1xx, F1xx] = pwelch(EEG_mean, blackman(winlength), [],...

winlength, Fs);

% graphical representation of the results

figure;

subplot(2,1,1)

plot(t,EEG_mean);

xlabel('t / s');

ylabel('Voltage U / mv');

axis([0 120 -600 600]);

title('Electroencephalogram for the Berger experiment');

subplot(2,1,2)

contourf(T,F,S1);

axis([0 120 0 30])

xlabel('t / s');

ylabel('f / Hz');

title('Time-frequency spectrum of the EEG');